import {get } from "../utils/request";
import { getToken } from "../utils/auth";

//获取mv列表
export const reqvideoAPI = (offset) => get("/mv/all?offset=" + offset + "&timestamp=" +
    Date.now() + "&cookie" + localStorage.getItem("cookie"), {
        withCredentials: true,
    });
//获取mv地址
export const reqMvAPI = (id) =>
    get(
        `/mv/url?id=${id}&r=1080&timestamp= 
${Date.now()}`, {
            withCredentials: true,
        }
    );
//获取 mv 数据
export const reqMvDataAPI = (id) =>
    get(`/mv/detail?mvid=${id}`, {
        withCredentials: true,
    });
//获取 mv 点赞转发评论数数据
export const reqMvDeAPI = (id) => get(`/mv/detail/info?mvid=${id}`, {
    withCredentials: true,
});
//获取搜索框
export const reqSsAPI = (name) =>
    get(`/cloudsearch?keywords=${name}`, {
        withCredentials: true,
    });
//默认搜索关键词
export const reqCIAPI = () => get(`/search/default?timestamp=${Date.now()}`, {
    timestamp: Date.now(),
    cookie: localStorage.getItem("cookie")
}, {
    withCredentials: true,
});
//热搜列表(详细)
export const reqSLiAPI = () =>
    get("/search/hot/detail?timestamp=" + Date.now(), {
        withCredentials: true,
    });
//搜索多重匹配
export const reqSPiAPI = (name) =>
    get(`/search/suggest?keywords=${name}&type=mobile?timestamp=${Date.now()}`, {
        withCredentials: true,
    });
//获取音乐 url
export const musicURL = (data) =>
    get(
        "/song/url?timestamp=" + Date.now(), { data }, {
            withCredentials: true,
        }
    );

//获取视频列表
export const videoListAPI = () => get("/video/group/list?timestamp=" + Date.now() + "&cookie" + localStorage.getItem("cookie"), {
    withCredentials: true,
});
// 获取视频分类列表  报301无法解决
export const videosListAPI = () => get("/video/category/list?timestamp=" + Date.now() + "&cookie=" + localStorage.getItem("cookie"), {
    withCredentials: true,
});
//获取视频列表
export const videoLiAPI = (id) => get("/video/group?id=" + id + "&timestamp=" + Date.now() + "&cookie=" + localStorage.getItem("cookie"), {
    withCredentials: true,
});

//获取视频详情
export const videoXiangAPI = (id) => get("/video/detail?id=" + id + "&timestamp=" + Date.now() + "&cookie=" + localStorage.getItem("cookie"), {
    withCredentials: true,
});
//获取视频详情
export const videoDhiAPI = (id) => get("/video/url?id=" + id + "&timestamp=" + Date.now() + "&cookie=" + localStorage.getItem("cookie"), {
    withCredentials: true,
});